package com.caishi.lkx.exam.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.caishi.lkx.exam.model.PaperModel;
import com.caishi.lkx.exam.vo.SpecialConditionVo;
import com.zzw.common.entity.BSService;
import com.zzw.common.service.service.SortService;


import java.io.IOException;
import java.net.URL;
import java.util.List;
import java.util.Map;

/**
 * @author by Jansia
 * @Date 2022/1/20 16:35
 */
public interface IPaperService extends BSService<PaperModel, String>, QuestionCollectionService<PaperModel, String>, SortService<PaperModel> {

    /**
     * 根据试卷id获取试卷信息
     *
     * @param resourceId 资源id
     * @return 试卷信息
     */
    PaperModel getPaperInfo(String resourceId);

    /**
     * 批量隐藏
     *
     * @param ids    id
     * @param isHide 是否隐藏
     * @return 隐藏结果
     */
    Boolean batchHide(List<String> ids, Boolean isHide);

    /**
     * 新增一个学习次数
     *
     * @param paperId 试卷id
     */
    void addNewStudent(String paperId);

    /**
     * 导出试卷
     *
     * @param paperId    试卷id
     * @param answerDesc 解析
     */
    URL exportPaper(String RecordsPaperId, String paperId, Boolean answerDesc) throws IOException;

    /**
     * 获取科目配置的全部试卷
     *
     * @param categoryId
     * @return
     */
    List<PaperModel> categoryAllPaper(Long categoryId);

    /**
     * 更改软删除状态
     *
     * @param paperModel
     * @return
     */
    int activation(PaperModel paperModel);

    /**
     * 根据栏目获取试卷
     *
     * @param page
     * @param param
     * @return
     */
    IPage<PaperModel> paperByColumnIdPage(Page<PaperModel> page, Map<String, Object> param);

    /**
     * 根据试题id科目id获取试卷列表
     *
     * @param cid        科目
     * @param questionId 试题id
     * @return
     */
    List<PaperModel> paperByQuestionId(Long cid, String questionId);

    /**
     * model 转换为es模型
     *
     * @param model
     * @param category
     * @return
     */
    //PaperEs modelTransEs(PaperModel model, CategoryModel category);

    /**
     * 根据试卷获取试题id
     *
     * @param paperIds
     * @return
     */
    List<String> getQuestionIdsByPaper(List<String> paperIds);

    void categoryGeneratePaper(Long categoryId, Long questionSourceCategoryId, SpecialConditionVo condition, String paperName, String columnId, String columnName, List<String> inIds, Boolean isScattered);

    /**
     * 获取未组成章节的试卷
     *
     * @param page
     * @param categoryId
     * @return
     */
    Page<PaperModel> paperChapterUnused(Page<PaperModel> page, Long categoryId, String keyword);
}
